﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NLUNZ.Business;
using System.Web.UI.HtmlControls;

namespace NLUNZ
{
    public partial class Site : MasterBasePage
    {
        public List<SlideImage> ActiveSlideImages; 
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadReferences();
            string bgColor = Global.BackgroundColor;
            if (String.IsNullOrEmpty(bgColor))
                bgColor = "#FFFFFF";
           
            form_Main.Attributes.CssStyle.Add("BACKGROUND-COLOR", bgColor);
            ActiveSlideImages = Repository.GetActiveSlideImages();
        }
        private void LoadReferences()
        {

            Page.Header.Controls.Add(GetCssControl("~/Styles/style.css"));
            Page.Header.Controls.Add(GetCssControl("~/Styles/site.css"));
            Page.Header.Controls.Add(GetJSControl("~/Scripts/jquery-1.4.1.min.js"));
            Page.Header.Controls.Add(GetJSControl("~/Scripts/scripts.js"));
            Page.Header.Controls.Add(GetJSControl("~/Scripts/jquery.simplyscroll.min.js"));
            Page.Header.Controls.Add(GetJSControl("~/Scripts/customScript.js"));
        }
        private HtmlGenericControl GetCssControl(string relativeUrl)
        {
            HtmlGenericControl oCss = new HtmlGenericControl();
            oCss.TagName = "link";
            oCss.Attributes.Add("type", "text/css");
            oCss.Attributes.Add("rel", "stylesheet");
            string url = ResolveClientUrl(relativeUrl);
            oCss.Attributes.Add("href", url);
            return oCss;
        }

        private HtmlGenericControl GetJSControl(string relativeUrl)
        {
            HtmlGenericControl js = new HtmlGenericControl();
            js.TagName = "script";
            js.Attributes.Add("type", "text/javascript");
            string url = ResolveClientUrl(relativeUrl);
            js.Attributes.Add("src", url);
            return js;
        }
        
    }


    public partial class MasterBasePage : System.Web.UI.MasterPage
    {
        internal static string BackgroundColor = "#FFFFFF";
        internal static string HeaderImageUrl = string.Empty;
    }
}